package chap3_9;

import java.util.Scanner;

public class Exer3_9_5 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入斐波拉切数列的项数：");
        int n = input.nextInt();
        int num1 = 1, num2 = 1, sum = 0;
        for (int i = 1; i <= n; i++) {
            if (i == 1) {
                System.out.print(num1 + "，");
            } else if (i == 2) {
                System.out.print(num2 + ",");
            } else {
                sum = num1 + num2;
                num1 = num2;
                num2 = sum;
                System.out.print(sum + "，");
            }
        }
    }
}
